﻿/*********************************************************************************************************************
VanguardDocumentation, Role VanguardDocumentationReader

This role is for those who are reading documentation. Since the documentation is stored in extended properties, anyone 
with access to an object may also read its documentation through the standard objects (sys.fn_listextendedproperty, 
etc.). This role however, will grant the reader permission to read *any* documentation in the database, and use our 
own procedures which should be much more readable.

© 2014 Erik Ackerholm

This file is part of SqlVanguard.

SqlVanguard is free software: you can redistribute it and/or modify it under the terms of the GNU General Public 
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later 
version.

SqlVanguard is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SqlVanguard. If not, see 
<http://www.gnu.org/licenses/>.
*********************************************************************************************************************/

if
	not exists (
		select *
		from sys.database_principals
		where name = 'VanguardDocumentationReader' and [type] = 'R'
	)
begin
	create role VanguardDocumentationReader;
end;
GO




